<?php
/**
 * Created by PhpStorm.
 * User: krystal
 * Date: 2019/3/7
 * Time: 13:59
 */

namespace app\common\validate;


use think\Validate;

/**
 * 课程评论验证器
 * Class CommentForTeach
 * @package app\common\validate
 */
class CommentForTeach extends  Validate
{

    public $rule=[
        'id' => 'require|number|gt:0',
        'content'=>'length:0,100',
        'score_for_comment' => 'require|number|gt:0',
        'video_comment_id' => 'require|number|gt:0',
        'type' => 'require|number|gt:0'
    ];

    public $message=[
        'id.require'=>'评论id必须输入',
        'id.number'=>'评论id必须是数字',
        'id.gt' => '评论不存在',
        'content.length'=>'评论内容必须在100字以内',
        'score_for_comment.require' => '评论分数必须输入',
        'score_for_comment.number' => '评论分数必须是数字',
        'score_for_comment.gt' => '评论分数必填',
        'video_comment_id.require' => '评论id必须输入',
        'video_comment_id.number' => '评论id必须是数字',
        'video_comment_id.gt' => '评论必填',
        'type.require' => '类型必填',
        'type.number' => '类型必须为数字',
        'type.gt' => '类型不存在'
    ];

    public $scene=[
        'save'=>[
            'id',
            'content',
            'score_for_comment'
        ],
        'update'=>[
            'video_comment_id',
            'content',
            'score_for_comment'
        ],
        'support_or_deny'=>[
            'video_comment_id',
            'type'
        ],
        'against_save'=>[
            'id',
            'content',
            'type'
        ],
    ];

    public $field=[
        'id'=>'评论id',
        'content'=>'评论或举报内容',
        'score_for_comment'=>'评论分数',
        'video_comment_id' => '评论id',
        'type' => '举报类型,文章或视频'
    ];

    /**
     * 检查内容信息
     */
//    public function checkContent()
//    {
//
//    }
}